package com.fuxi.cloud.desreport.render.handler;

import com.alibaba.fastjson.JSONObject;
import com.fuxi.cloud.desreport.model.RenderInfo;
import com.fuxi.cloud.desreport.model.ReportDbInfo;
import com.fuxi.cloud.desreport.render.utils.RegexMatches;

/**
 * RowRenderHandler
 *
 * @Author: 扫地僧
 * @CreateTime: 2021-05-03
 */
public interface RowRenderHandler {
    boolean support(JSONObject var1);

    String getTemplate(String var1, Integer var2, String var3, JSONObject var4, JSONObject var5);

    default JSONObject beforeRenderRows(RenderInfo renderInfo, JSONObject rows) {
        return rows;
    }

    default JSONObject beforeRenderRow(RenderInfo renderInfo, JSONObject rows, JSONObject currentRow, Integer rowIndex) {
        return null;
    }

    JSONObject render(RenderInfo var1, JSONObject var2, JSONObject var3, Integer var4, Integer var5);

    Object getData(RenderInfo var1, ReportDbInfo var2);

    default String getDataSetKey(String text) {
        return RegexMatches.a(text, 1);
    }

    default JSONObject afterRenderRow(RenderInfo renderInfo, JSONObject row, JSONObject dynamicRowObj, Integer dynamicRowEndIndex) {
        return dynamicRowObj;
    }
}

